package com.zhangyujun.study.controller;

import dev.langchain4j.model.chat.ChatModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zhangyujun
 * @Description: TODO
 * @DateTime: 2025/7/27 15:54
 **/
@RestController
@Slf4j
public class HelloLangChain4JController {
    @Autowired
    private ChatModel chatModel;
    @RequestMapping("/langchain4j/hello")
    public String hello(@RequestParam(value = "question",defaultValue = "你是谁") String question) {
        String chat = chatModel.chat(question);
        log.info("question:{},answer:{}",question,chat);
        return chat;
    }
}
